package com.kbbywyclient.ui.activity;

import android.webkit.WebSettings;

import com.kbbywyclient.R;
import com.kbbywyclient.app.API;
import com.kbbywyclient.di.AppComponent;
import com.kbbywyclient.ui.activity.base.BaseActivity;
import com.kbbywyclient.util.LogUtil;
import com.kbbywyclient.util.RsaJsonUtil;
import com.kbbywyclient.util.pre.PreUtils;
import com.kbbywyclient.widget.CustomToolBar;
import com.kbbywyclient.widget.ProgressWebView;

import butterknife.BindView;

/**
 * Description: 赚取方式
 * Created by FHW
 * on 2017/5/8
 */

public class ScoreEarnActivity extends BaseActivity {

    @BindView(R.id.v_toolbar)
    CustomToolBar v_toolbar;
    @BindView(R.id.wv_contact)
    ProgressWebView wv_contact;

    private RsaJsonUtil rsaJsonUtil;
    private String params = "";

    @Override
    protected int provideContentViewId() {
        return R.layout.activity_score_earn;
    }

    @Override
    protected void onResume() {
        super.onResume();
        setScreenName("积分赚取方式");
    }

    @Override
    protected void initView() {
        rsaJsonUtil = new RsaJsonUtil();

        v_toolbar.setLeftViewOnClickLinster(v -> finish());

        //设置webview
        wv_contact.getSettings().setDefaultTextEncodingName("UTF-8");
        //webview自适应屏幕
        WebSettings settings = wv_contact.getSettings();
        settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
        //                    settings.setBuiltInZoomControls(true); //显示放大缩小
        //                    settings.setSupportZoom(true); //可以缩放
        // webview自适应第二种
        settings.setUseWideViewPort(true);
        settings.setLoadWithOverviewMode(true);
        wv_contact.setSaveEnabled(true);
        settings.setJavaScriptEnabled(true); // 设置支持javascript脚本

        rsaJsonUtil.put("SalesID", PreUtils.getUser(this).getSalesID() + "");
        params = rsaJsonUtil.getRsaParams();
        String url = API.SCORE_EARN + "?params=" + params;
        LogUtil.d(url);
        wv_contact.loadUrl(url);

    }

    @Override
    public void initData() {

    }

    @Override
    public void initAppComponent(AppComponent appComponent) {

    }
}
